// 支付类接口
import request from '@/utils/request'

/**
 * 获取交易页信息
 */
export const reqGetTrade = () => {
	return request({
		method: 'GET',
		url: '/order/auth/trade',
	})
}

/**
 * 提交订单
 * @param {*} param0
 * @returns
 */
export const reqSubmitOrder = ({ tradeNo, ...data }) => {
	return request({
		method: 'POST',
		url: '/order/auth/submitOrder',
		data,
		params: {
			tradeNo,
		},
	})
}

/**
  * 
    获取订单支付信息  （二维码）
  * @param {*} orderId 
  * @returns 
  *   codeUrl  "weixin://wxpay/bizpayurl?pr=npj6T4pzz"
      orderId 3783
      resultCode "SUCCESS"
      totalFee 73336
  */
export const reqPayOrder = (orderId) => {
	return request({
		method: 'GET',
		url: `/payment/weixin/createNative/${orderId}`,
	})
}

/**
 * 查询订单是否完成
 * @param {*} orderId
 * @returns
 */
export const reqPayStatus = (orderId) => {
	return request({
		method: 'GET',
		url: `/payment/weixin/queryPayStatus/${orderId}`,
	})
}

/**
 * 我的订单数据
 * @param {*} page 
 * @param {*} limit 
 * @returns 
 */
export const reqGetOrderAuth = (page, limit) => {
	return request({
		method: 'GET',
		url: `/order/auth/${page}/${limit}`,
	})
}
